package org.example.myleet.p693;

public class Solution {
    public boolean hasAlternatingBits(int n) {
        int lastBit = n & 1, curBit;
        while (n > 0) {
            n >>>= 1;
            curBit = n & 1;
            if (curBit == lastBit) {
                return false;
            }
            lastBit = curBit;
        }
        return true;
    }
}
